package com.ruoyi.qiushi.service.equipment.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.qiushi.domain.equipment.QiushiDeviceOut;
import com.ruoyi.qiushi.mapper.equipment.QiushiDeviceOutMapper;
import com.ruoyi.qiushi.service.equipment.IQiushiDeviceOutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 设备出库Service业务层处理
 *
 * @author ruoyi
 * @date 2023-12-22
 */
@Service
public class QiushiDeviceOutServiceImpl implements IQiushiDeviceOutService {
    @Autowired
    private QiushiDeviceOutMapper qiushiDeviceOutMapper;

    /**
     * 查询设备出库
     *
     * @param id 设备出库主键
     * @return 设备出库
     */
    @Override
    public QiushiDeviceOut selectQiushiDeviceOutById(Long id) {
        return qiushiDeviceOutMapper.selectQiushiDeviceOutById(id);
    }

    /**
     * 查询设备出库列表
     *
     * @param qiushiDeviceOut 设备出库
     * @return 设备出库
     */
    @Override
    public List<QiushiDeviceOut> selectQiushiDeviceOutList(QiushiDeviceOut qiushiDeviceOut) {
        return qiushiDeviceOutMapper.selectQiushiDeviceOutList(qiushiDeviceOut);
    }

    /**
     * 新增设备出库
     *
     * @param qiushiDeviceOut 设备出库
     * @return 结果
     */
    @Override
    public int insertQiushiDeviceOut(QiushiDeviceOut qiushiDeviceOut) {
        qiushiDeviceOut.setCreateTime(DateUtils.getNowDate());
        qiushiDeviceOut.setOperatingUserId(SecurityUtils.getUserId());
        qiushiDeviceOut.setOperatingUserName(SecurityUtils.getUsername());

        return qiushiDeviceOutMapper.insertQiushiDeviceOut(qiushiDeviceOut);
    }

    /**
     * 修改设备出库
     *
     * @param qiushiDeviceOut 设备出库
     * @return 结果
     */
    @Override
    public int updateQiushiDeviceOut(QiushiDeviceOut qiushiDeviceOut) {
        qiushiDeviceOut.setUpdateTime(DateUtils.getNowDate());
        qiushiDeviceOut.setOperatingUserId(SecurityUtils.getUserId());
        qiushiDeviceOut.setOperatingUserName(SecurityUtils.getUsername());

        return qiushiDeviceOutMapper.updateQiushiDeviceOut(qiushiDeviceOut);
    }

    /**
     * 删除设备出库信息
     *
     * @param id 设备出库主键
     * @return 结果
     */
    @Override
    public int deleteQiushiDeviceOutById(Long id) {
        return qiushiDeviceOutMapper.deleteQiushiDeviceOutById(id);
    }
}
